CFLAGS = -Wall -g -c
ASMFLAGS = -f coff
INCLS = mouse.o sprite.o video.o kbd.o kbc.o queue.o ints.o music.o intasm.o timer.o rtc.o GQueue.o mouse_asm.o .\kbc\kbc_init.o codepage.o 

all: exe

rebuild: clean clean_lib exe

exe: $(INCLS) Makefile
	ar -cr ..\libpang.a $(INCLS)
	
mouse.o: mouse.h GQueue.h video.h kbc.h Makefile
	gcc $(CFLAGS) mouse.c

sprite.o: sprite.h video.h Makefile
	gcc $(CFLAGS) sprite.c

video.o: video.h Makefile
	gcc $(CFLAGS) video.c
	
kbc.o: kbc.c kbc.h Makefile
	gcc $(CFLAGS) kbc.c
	
rtc.o: rtc.c rtc.h Makefile
	gcc $(CFLAGS) rtc.c
	
ints.o: ints.h ints.c Makefile
	gcc $(CFLAGS) ints.c
	
queue.o: queue.c queue.h Makefile
	gcc $(CFLAGS) queue.c
	
GQueue.o: GQueue.c GQueue.h Makefile
	gcc $(CFLAGS) GQueue.c
	
music.o: music.c music.h ints.h timer.h Makefile
	gcc $(CFLAGS) music.c
	
timer.o: TIMER.C timer.h intasm.o Makefile
	gcc $(CFLAGS) timer.c

codepage.o: codepage.c codepage.h Makefile
	gcc $(CFLAGS) codepage.c
	
kbd.o: kbd.asm Makefile
	nasm $(ASMFLAGS) kbd.asm -o kbd.o
	
intasm.o: intasm.asm Makefile
	nasm $(ASMFLAGS) intasm.asm -o intasm.o
	
mouse_asm.o: mouse.asm Makefile
	nasm $(ASMFLAGS) mouse.asm -o mouse_asm.o
	
clean:
	del *.o
clean_lib:
	del ..\liblcom.a